<%--
  User: yang
  Date: 8/21/20
  Time: 20:18
  Description: TODO 
--%>
<%@page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%-- 导入核心标签库 --%>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>学生管理系统</title>
    <%--  新 Bootstrap 核心 CSS 文件 --%>
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <script src="http://libs.baidu.com/jquery/1.7.0/jquery.min.js"></script>
    <%--  导入 jQuery   --%>
    <%--  最新的 Bootstrap 核心 JavaScript 文件   --%>
    <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <style>
        h1 {
            align-content: center;
        }

        div {
            height: 800px;
            margin-bottom: 50px;
            border: 1px solid red;
        }

        h2 {
            text-align: center;
        }

        table {
            margin: 10px auto;
            border-collapse: collapse;
            height: 250px;
            width: 250px;
        }

        td {
            border: 1px solid blue;
        }

        #loginNumber {
            border-radius: 5px;
            border: 2px solid blue;
            font-size: 20px;
            position: fixed;
            width: 150px;
            left: 20px;
            text-align: center;
        }
    </style>
</head>
<body>


<div style="height: 800px;overflow:auto;">
    <h2>获取所有</h2>

    <c:if test="${empty all}">
        <%-- 为空，去请求       --%>
        <jsp:forward page="/student/getAll.action"/>
    </c:if>

    <table>
        <tr>
            <th>学号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>分数</th>
            <th>党员</th>
        </tr>
        <c:forEach items="${all}" var="stu">
            <tr>
                <td>${stu.sid}</td>
                <td>${stu.sname}</td>
                <td>${stu.sex}</td>
                <td>${stu.score}</td>
                <td>
                    <c:choose>
                        <c:when test="${stu.sdangyuan}"> 是 </c:when>
                        <c:otherwise>否</c:otherwise>
                    </c:choose>
                </td>
            </tr>
        </c:forEach>
    </table>


</div>
<div style="height: 400px">
    <h2>增</h2>
    <form action="<c:url value='/student/addOne.action'/>" method="post" id="addOne">
        <table>
            <tr>
                <td>学生姓名</td>
                <td><input type="text" name="sname"></td>
            </tr>
            <tr>
                <td>学生性别</td>
                <td>
                    男<input type="radio" value="男" name="sex" checked/>
                    &nbsp;
                    女<input type="radio" value="女" name="sex"/>
                </td>
            </tr>
            <tr>
                <td>学生分数</td>
                <td><input type="number" name="score"></td>
            </tr>
            <tr>
                <td>学生是不是党员</td>
                <td>
                    是<input type="radio" value="true" name="sdangyuan" checked/>
                    &nbsp;
                    不是<input type="radio" value="false" name="sdangyuan"/>
                </td>
            </tr>

            <tr>
                <td colspan="2">
                    <input type="reset" value="重置">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="submit" value="提交">
                </td>
            </tr>
        </table>

    </form>
</div>

<div style="height: 150px">
    <h2>删</h2>
    <h2>
        <form action="<c:url value='/student/delOne.action'/>" method="post" id="delOne">
            学生ID <input type="number" name="sid"> &nbsp;
            <input type="submit" value="提交">
        </form>
    </h2>


</div>
<div style="height: 400px">
    <h2>改</h2>
    <form action="<c:url value='/student/updateOne.action'/>" method="post">
        <table id="changeOne">
            <tr>
                <td>学生 id</td>
                <td><input type="number" name="sid"></td>
            </tr>
            <tr>
                <td>学生姓名</td>
                <td><input type="text" name="sname"></td>
            </tr>
            <tr>
                <td>学生性别</td>
                <td>
                    男<input type="radio" value="男" name="sex" checked/>
                    &nbsp;
                    女<input type="radio" value="女" name="sex"/>
                </td>
            </tr>
            <tr>
                <td>学生分数</td>
                <td><input type="number" name="score"></td>
            </tr>
            <tr>
                <td>学生是不是党员</td>
                <td>
                    是<input type="radio" value="true" name="sdangyuan" checked/>
                    &nbsp;
                    不是<input type="radio" value="false" name="sdangyuan"/>
                </td>
            </tr>

            <tr>
                <td colspan="2">
                    <input type="reset" value="重置">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="submit" value="提交">
                </td>
            </tr>
        </table>

    </form>
</div>


<div style="height: 150px">
    <h2>查</h2>
    <h2>
        <form action="<c:url value='/student/getOneBySid.action'/>" method="post">
            学生ID <input type="number" name="sid"> &nbsp;
            <input type="submit" value="提交">
        </form>
    </h2>

    <table>
        <tr>
            <th>学号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>分数</th>
            <th>党员</th>
        </tr>
        <c:if test="${not empty student}">
            <tr>
                <td>${student.sid}</td>
                <td>${student.sname}</td>
                <td>${student.sex}</td>
                <td>${student.score}</td>
                <td>
                    <c:choose>
                        <c:when test="${student.sdangyuan}"> 是 </c:when>
                        <c:otherwise>否</c:otherwise>
                    </c:choose>
                </td>
            </tr>
        </c:if>
    </table>
</div>


</body>
</html>
